
#include"processbar.h"
#include<time.h>
#include<stdlib.h>
#define Downloadsize 1024*1024*1024
void Dowload(callback_t pc)
{
    int total=Downloadsize;
    srand((unsigned int)time(NULL)^1023);
    while(total)
    {
    int one=rand()%1023*1023;
    usleep(100000);



    total-=one;
    if(total<0)total=0;
    int download=Downloadsize-total;
    double  rate=((download*1.0)/(Downloadsize))*100.0;
    //printf("%0.1f\n",rate);
    pc(rate);
    }
}
int main()
{
    //process1();
    //process2();
    Dowload(process_flush);
    return 0;
}
